package com;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map.Entry;
import java.util.Properties;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class InitListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		Properties prop = new Properties(); 
		try {
			InputStream in = InitListener.class.getClassLoader().getResourceAsStream("app.properties"); 
			prop.load(in);
			for (Entry<Object, Object> entry : prop.entrySet()) {
				String key = entry.getKey().toString();
				String value = entry.getValue().toString();
				AppUtils.config.put(key, value);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} 
	}

}
